Splitting a word from another word
by Savonnah '23
def split(word1, word2):
result = word1.rstrip(word2)
return result
Function Call | Return Value | |||
---|---|---|---|---|
split('carwash', 'wash') | → | |||
split('strawberry', 'berry') | → | |||
split('hotdog', 'dog') | → | |||
split('hamburger', 'burger') | → |
Experiment with this code on Gitpod.io